home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / LINUX / VIDEODEV.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  9KB  |  290 lines

  1. #ifndef __LINUX_VIDEODEV_H
  2. #define __LINUX_VIDEODEV_H
  3.  
  4. #include <linux/types.h>
  5. #include <linux/version.h>
  6.  
  7. #ifdef __KERNEL__
  8.  
  9. #if LINUX_VERSION_CODE >= 0x020100
  10. #include <linux/poll.h>
  11. #endif
  12.  
  13. struct video_device
  14. {
  15.     char name[32];
  16.     int type;
  17.     int hardware;
  18.  
  19.     int (*open)(struct video_device *, int mode);
  20.     void (*close)(struct video_device *);
  21.     long (*read)(struct video_device *, char *, unsigned long, int noblock);
  22.     /* Do we need a write method ? */
  23.     long (*write)(struct video_device *, const char *, unsigned long, int noblock);
  24. #if LINUX_VERSION_CODE >= 0x020100
  25.     unsigned int (*poll)(struct video_device *, struct file *, poll_table *);
  26. #endif
  27.     int (*ioctl)(struct video_device *, unsigned int , void *);
  28.     int (*mmap)(struct video_device *, const char *, unsigned long);
  29.     int (*initialize)(struct video_device *);    
  30.     void *priv;        /* Used to be 'private' but that upsets C++ */
  31.     int busy;
  32.     int minor;
  33. };
  34.  
  35. extern int videodev_init(void);
  36. #define VIDEO_MAJOR    81
  37. extern int video_register_device(struct video_device *, int type);
  38.  
  39. #define VFL_TYPE_GRABBER    0
  40. #define VFL_TYPE_VBI        1
  41. #define VFL_TYPE_RADIO        2
  42. #define VFL_TYPE_VTX        3
  43.  
  44. extern void video_unregister_device(struct video_device *);
  45. #endif
  46.  
  47.  
  48. #define VID_TYPE_CAPTURE    1    /* Can capture */
  49. #define VID_TYPE_TUNER        2    /* Can tune */
  50. #define VID_TYPE_TELETEXT    4    /* Does teletext */
  51. #define VID_TYPE_OVERLAY    8    /* Overlay onto frame buffer */
  52. #define VID_TYPE_CHROMAKEY    16    /* Overlay by chromakey */
  53. #define VID_TYPE_CLIPPING    32    /* Can clip */
  54. #define VID_TYPE_FRAMERAM    64    /* Uses the frame buffer memory */
  55. #define VID_TYPE_SCALES        128    /* Scalable */
  56. #define VID_TYPE_MONOCHROME    256    /* Monochrome only */
  57. #define VID_TYPE_SUBCAPTURE    512    /* Can capture subareas of the image */
  58.  
  59. struct video_capability
  60. {
  61.     char name[32];
  62.     int type;
  63.     int channels;    /* Num channels */
  64.     int audios;    /* Num audio devices */
  65.     int maxwidth;    /* Supported width */
  66.     int maxheight;    /* And height */
  67.     int minwidth;    /* Supported width */
  68.     int minheight;    /* And height */
  69. };
  70.  
  71.  
  72. struct video_channel
  73. {
  74.     int channel;
  75.     char name[32];
  76.     int tuners;
  77.     __u32  flags;
  78. #define VIDEO_VC_TUNER        1    /* Channel has a tuner */
  79. #define VIDEO_VC_AUDIO        2    /* Channel has audio */
  80.     __u16  type;
  81. #define VIDEO_TYPE_TV        1
  82. #define VIDEO_TYPE_CAMERA    2    
  83.     __u16 norm;            /* Norm set by channel */
  84. };
  85.  
  86. struct video_tuner
  87. {
  88.     int tuner;
  89.     char name[32];
  90.     ulong rangelow, rangehigh;    /* Tuner range */
  91.     __u32 flags;
  92. #define VIDEO_TUNER_PAL        1
  93. #define VIDEO_TUNER_NTSC    2
  94. #define VIDEO_TUNER_SECAM    4
  95. #define VIDEO_TUNER_LOW        8    /* Uses KHz not MHz */
  96. #define VIDEO_TUNER_NORM    16    /* Tuner can set norm */
  97. #define VIDEO_TUNER_STEREO_ON    128    /* Tuner is seeing stereo */
  98.     __u16 mode;            /* PAL/NTSC/SECAM/OTHER */
  99. #define VIDEO_MODE_PAL        0
  100. #define VIDEO_MODE_NTSC        1
  101. #define VIDEO_MODE_SECAM    2
  102. #define VIDEO_MODE_AUTO        3
  103.     __u16 signal;            /* Signal strength 16bit scale */
  104. };
  105.  
  106. struct video_picture
  107. {
  108.     __u16    brightness;
  109.     __u16    hue;
  110.     __u16    colour;
  111.     __u16    contrast;
  112.     __u16    whiteness;    /* Black and white only */
  113.     __u16    depth;        /* Capture depth */
  114.     __u16   palette;    /* Palette in use */
  115. #define VIDEO_PALETTE_GREY    1    /* Linear greyscale */
  116. #define VIDEO_PALETTE_HI240    2    /* High 240 cube (BT848) */
  117. #define VIDEO_PALETTE_RGB565    3    /* 565 16 bit RGB */
  118. #define VIDEO_PALETTE_RGB24    4    /* 24bit RGB */
  119. #define VIDEO_PALETTE_RGB32    5    /* 32bit RGB */    
  120. #define VIDEO_PALETTE_RGB555    6    /* 555 15bit RGB */
  121. #define VIDEO_PALETTE_YUV422    7    /* YUV422 capture */
  122. #define VIDEO_PALETTE_YUYV    8
  123. #define VIDEO_PALETTE_UYVY    9    /* The great thing about standards is ... */
  124. #define VIDEO_PALETTE_YUV420    10
  125. #define VIDEO_PALETTE_YUV411    11    /* YUV411 capture */
  126. #define VIDEO_PALETTE_RAW    12    /* RAW capture (BT848) */
  127. #define VIDEO_PALETTE_YUV422P    13    /* YUV 4:2:2 Planar */
  128. #define VIDEO_PALETTE_YUV411P    14    /* YUV 4:1:1 Planar */
  129. #define VIDEO_PALETTE_YUV420P    15    /* YUV 4:2:0 Planar */
  130. #define VIDEO_PALETTE_YUV410P    16    /* YUV 4:1:0 Planar */
  131. #define VIDEO_PALETTE_PLANAR    13    /* start of planar entries */
  132. #define VIDEO_PALETTE_COMPONENT 7    /* start of component entries */
  133. };
  134.  
  135. struct video_audio
  136. {
  137.     int    audio;        /* Audio channel */
  138.     __u16    volume;        /* If settable */
  139.     __u16    bass, treble;
  140.     __u32    flags;
  141. #define VIDEO_AUDIO_MUTE    1
  142. #define VIDEO_AUDIO_MUTABLE    2
  143. #define VIDEO_AUDIO_VOLUME    4
  144. #define VIDEO_AUDIO_BASS    8
  145. #define VIDEO_AUDIO_TREBLE    16    
  146.     char    name[16];
  147. #define VIDEO_SOUND_MONO    1
  148. #define VIDEO_SOUND_STEREO    2
  149. #define VIDEO_SOUND_LANG1    4
  150. #define VIDEO_SOUND_LANG2    8
  151.         __u16   mode;
  152.         __u16    balance;    /* Stereo balance */
  153.         __u16    step;        /* Step actual volume uses */
  154. };
  155.  
  156. struct video_clip
  157. {
  158.     __s32    x,y;
  159.     __s32    width, height;
  160.     struct    video_clip *next;    /* For user use/driver use only */
  161. };
  162.  
  163. struct video_window
  164. {
  165.     __u32    x,y;            /* Position of window */
  166.     __u32    width,height;        /* Its size */
  167.     __u32    chromakey;
  168.     __u32    flags;
  169.     struct    video_clip *clips;    /* Set only */
  170.     int    clipcount;
  171. #define VIDEO_WINDOW_INTERLACE    1
  172. #define VIDEO_CLIP_BITMAP    -1
  173. /* bitmap is 1024x625, a '1' bit represents a clipped pixel */
  174. #define VIDEO_CLIPMAP_SIZE    (128 * 625)
  175. };
  176.  
  177. struct video_capture
  178. {
  179.     __u32     x,y;            /* Offsets into image */
  180.     __u32    width, height;        /* Area to capture */
  181.     __u16    decimation;        /* Decimation divder */
  182.     __u16    flags;            /* Flags for capture */
  183. #define VIDEO_CAPTURE_ODD        0    /* Temporal */
  184. #define VIDEO_CAPTURE_EVEN        1
  185. };
  186.  
  187. struct video_buffer
  188. {
  189.     void    *base;
  190.     int    height,width;
  191.     int    depth;
  192.     int    bytesperline;
  193. };
  194.  
  195. struct video_mmap
  196. {
  197.     unsigned    int frame;        /* Frame (0 - n) for double buffer */
  198.     int        height,width;
  199.     unsigned    int format;        /* should be VIDEO_PALETTE_* */
  200. };
  201.  
  202. struct video_key
  203. {
  204.     __u8    key[8];
  205.     __u32    flags;
  206. };
  207.  
  208.  
  209. #define VIDEO_MAX_FRAME        32
  210.  
  211. struct video_mbuf
  212. {
  213.     int    size;        /* Total memory to map */
  214.     int    frames;        /* Frames */
  215.     int    offsets[VIDEO_MAX_FRAME];
  216. };
  217.     
  218.  
  219. #define     VIDEO_NO_UNIT    (-1)
  220.  
  221.     
  222. struct video_unit
  223. {
  224.     int     video;        /* Video minor */
  225.     int    vbi;        /* VBI minor */
  226.     int    radio;        /* Radio minor */
  227.     int    audio;        /* Audio minor */
  228.     int    teletext;    /* Teletext minor */
  229. };
  230.  
  231. #define VIDIOCGCAP        _IOR('v',1,struct video_capability)    /* Get capabilities */
  232. #define VIDIOCGCHAN        _IOWR('v',2,struct video_channel)    /* Get channel info (sources) */
  233. #define VIDIOCSCHAN        _IOW('v',3,struct video_channel)    /* Set channel     */
  234. #define VIDIOCGTUNER        _IOWR('v',4,struct video_tuner)        /* Get tuner abilities */
  235. #define VIDIOCSTUNER        _IOW('v',5,struct video_tuner)        /* Tune the tuner for the current channel */
  236. #define VIDIOCGPICT        _IOR('v',6,struct video_picture)    /* Get picture properties */
  237. #define VIDIOCSPICT        _IOW('v',7,struct video_picture)    /* Set picture properties */
  238. #define VIDIOCCAPTURE        _IOW('v',8,int)                /* Start, end capture */
  239. #define VIDIOCGWIN        _IOR('v',9, struct video_window)    /* Set the video overlay window */
  240. #define VIDIOCSWIN        _IOW('v',10, struct video_window)    /* Set the video overlay window - passes clip list for hardware smarts , chromakey etc */
  241. #define VIDIOCGFBUF        _IOR('v',11, struct video_buffer)    /* Get frame buffer */
  242. #define VIDIOCSFBUF        _IOW('v',12, struct video_buffer)    /* Set frame buffer - root only */
  243. #define VIDIOCKEY        _IOR('v',13, struct video_key)        /* Video key event - to dev 255 is to all - cuts capture on all DMA windows with this key (0xFFFFFFFF == all) */
  244. #define VIDIOCGFREQ        _IOR('v',14, unsigned long)        /* Set tuner */
  245. #define VIDIOCSFREQ        _IOW('v',15, unsigned long)        /* Set tuner */
  246. #define VIDIOCGAUDIO        _IOR('v',16, struct video_audio)    /* Get audio info */
  247. #define VIDIOCSAUDIO        _IOW('v',17, struct video_audio)    /* Audio source, mute etc */
  248. #define VIDIOCSYNC        _IOW('v',18, int)            /* Sync with mmap grabbing */
  249. #define VIDIOCMCAPTURE        _IOW('v',19, struct video_mmap)        /* Grab frames */
  250. #define VIDIOCGMBUF        _IOR('v', 20, struct video_mbuf)    /* Memory map buffer info */
  251. #define VIDIOCGUNIT        _IOR('v', 21, struct video_unit)    /* Get attached units */
  252. #define VIDIOCGCAPTURE        _IOR('v',22, struct video_capture)    /* Get frame buffer */
  253. #define VIDIOCSCAPTURE        _IOW('v',23, struct video_capture)    /* Set frame buffer - root only */
  254.  
  255. #define BASE_VIDIOCPRIVATE    192        /* 192-255 are private */
  256.  
  257.  
  258. #define VID_HARDWARE_BT848    1
  259. #define VID_HARDWARE_QCAM_BW    2
  260. #define VID_HARDWARE_PMS    3
  261. #define VID_HARDWARE_QCAM_C    4
  262. #define VID_HARDWARE_PSEUDO    5
  263. #define VID_HARDWARE_SAA5249    6
  264. #define VID_HARDWARE_AZTECH    7
  265. #define VID_HARDWARE_SF16MI    8
  266. #define VID_HARDWARE_RTRACK    9
  267. #define VID_HARDWARE_ZOLTRIX    10
  268. #define VID_HARDWARE_SAA7146    11
  269. #define VID_HARDWARE_VIDEUM    12    /* Reserved for Winnov videum */
  270. #define VID_HARDWARE_RTRACK2    13
  271. #define VID_HARDWARE_PERMEDIA2    14    /* Reserved for Permedia2 */
  272. #define VID_HARDWARE_RIVA128    15    /* Reserved for RIVA 128 */
  273. #define VID_HARDWARE_PLANB    16    /* PowerMac motherboard video-in */
  274. #define VID_HARDWARE_BROADWAY    17    /* Broadway project */
  275. #define VID_HARDWARE_GEMTEK    18
  276. #define VID_HARDWARE_TYPHOON    19
  277. #define VID_HARDWARE_VINO    20    /* Reserved for SGI Indy Vino */
  278.  
  279. /*
  280.  *    Initialiser list
  281.  */
  282.  
  283. struct video_init
  284. {
  285.     char *name;
  286.     int (*init)(struct video_init *);
  287. };
  288.  
  289. #endif
  290.